package org.gdstash.quest;

import org.gdstash.character.GDCharUID;
import org.gdstash.file.GDReader;
import org.gdstash.util.FileVersionException;
import org.gdstash.util.GDMsgFormatter;

import java.io.IOException;

public class GDQuest {
    private int id1;
    private GDCharUID id2;
    private GDQuestTaskList tasks;

    public GDQuest() {
        this.id2 = new GDCharUID();
        this.tasks = new GDQuestTaskList();
    }

    public void read() throws IOException {
        int val = 0;
        this.id1 = GDReader.readEncInt(true);
        this.id2.read();
        final GDReader.Block block = new GDReader.Block();
        val = GDReader.readBlockStart(block);
        if (val != 0) {
            throw new FileVersionException(GDMsgFormatter.getString(GDMsgFormatter.rbMsg, "ERR_UNSUPPORTED_VERSION"));
        }
        this.tasks.read();
        GDReader.readBlockEnd(block);
    }
}
